package com.fengyunhe.common.utils;

import javax.servlet.http.HttpServletRequest;

/**
 * 功能：微信客户端工具
 * 作者： yangyan
 * 时间： 2014/10/29 .
 */
public class WechatClientUtils {
    /**
     * 判断浏览器是不是微信
     *
     * @param request
     * @return
     */
    public static boolean clientIsMicroMessenger(HttpServletRequest request) {
        String agent = request.getHeader("User-Agent");
        if (agent != null && agent.indexOf("MicroMessenger") > -1) {
            request.getSession(true).setAttribute("clientIsMicroMessenger",
                    true);
            return true;
        }
        request.getSession(true).setAttribute("clientIsMicroMessenger", false);
        return false;
    }
}
